﻿
using System.Linq;

namespace CNav.Common
{
    public static class ResponseDataExt
    {
        public static bool Validate<T>(this ResponseData<T> response)
        {
            if (response.Error != null && response.Error.Any())
            {
                return false;
            }

            return true;
        }

        public static void ValidateAndThrow<T>(this ResponseData<T> response)
        {
            if (response.Error != null)
            {
                throw new ResponseDataException(response.Error);
            }
        }
    }
}
